adb bugreport 到本地 adb导出bugreport

您所在的位置:网站首页 adb bugreport 保存在哪 adb bugreport 到本地 adb导出bugreport

adb bugreport 到本地 adb导出bugreport

2024-07-13 14:35:05| 来源: 网络整理| 查看: 265

ADB命令常用 ADB 命令导入文件到手机adb push local remote

e.g

adb push D:\Desktop\安装包\保意\20200302正式线替换图标\laiDianYi-release.apk sdcard导出手机文件adb pull remote local导出bug日志(anr也可以查看)//1. 生成bug日志 adb bugreport //2. cd到d盘下。拉取上一步生成的bugreport adb pull /data/user_de/0/com.android.shell找到d:/com.android.shell/files/bugreports,解压zip文件,其中anr日志在zip内的FS/data/anr内列出设备(验证手机是否连上adb)adb devices查看安卓包名

法一:adb shell am monitor

然后启动需要获取包名的应用

法二:adb shell pm list packages -3

查看自己安装的 app 包名

法三:安卓系统中:设置–应用–正在运行 查看

法四:安卓系统:文件管理器访问目录/data/data 下,文件夹即为包名

法五:将 apk 反编译,查看 AndroidManifest.xml 中的 package

安装apkadb -s 真机序列号 install **.apk

adb -s 127.0.0.1:6555 install -r **.apk

其中 -s SD卡;-r 重装

如果只有一台真机,那么直接adb -s install **.apk

卸载apkadb uninstall 包名重启设备adb -s 真机序列号 reboot查看文件adb -s 真机序列号 shell cd到文件目录下 lsADB 命令截屏

截屏 screencap

adb shell screencap 文件保存路径ADB 命令录像

录像 screenrecord

adb shell screenrecord 文件保存路径

按 Control + C 停止屏幕录制,否则,到三分钟或 --time-limit 设置的时间限制时,录制将自动停止。

screenrecord 部分参数

选项

说明

–size width x height

设置分辨率 eg:1280x720

–bit-rate rate

视频比特率,默认值为 4Mbps,可以设6Mbps,这样质量更好 eg:adb shell screenrecord --bit-rate 6000000 /sdcard/demo.mp4

–time-limit time

设置最大录制时长(以秒为单位)。默认值和最大值均为 180(3 分钟)。

调用ActivityManager(am 命令)发送 intentadb shell am start -a android.intent.action.VIEW启动Activityadb shell am start -n 包名/类名

e.g:

adb shell dumpsys activity|findstr Run 找到正在运行的某个activity(com.tencent.mobileqq/.activity.SplashActivity) adb shell am start -n com.tencent.mobileqq/.activity.SplashActivity启动serviceadb shell am startservice 包名/类名

e.g:

adb shell am startservice -n com.programandroid/.Service.BindServiceMethod发送广播adb shell am broadcast -a 广播Action

e.g:

adb shell am broadcast -a "android.intent.action.BOOT_COMPLETED"强行停止应用adb shell force-stop 包名

e.g:

adb shell dumpsys activity|findstr Run 找到某个正在运行的activity(com.tencent.mobileqq/.activity.LoginActivity) 查看正在运行的应用情况 adb shell ps|findstr mobileqq adb shell am force-stop com.tencent.mobileqq 再次查看这个正在运行的应用情况 adb shell ps|findstr mobileqq adb shell dumpsys activity|findstr Run使用adb 命令进入recovery 模式

进入Recovery 模式可以使用组合键,也可以使用adb 命令 adb 命令进入recovery 模式如下

adb reboot recovery跳过Google 开机向导的命令adb shell pm disable com.google.android.setupwizard adb shell settings put global device_provisioned 1 adb shell settings put secure user_setup_complete 1启动开机向导命令C:\Users\Administrator>adb shell am start com.google.android.setupwizard/.user.WelcomeActivity Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.google.android.setupwizard/.user.WelcomeActivity } C:\Users\Administrator>调用 PackageManager(pm 命令)卸载apkadb shell pm uninstall 包名查看手机中所有apk 包名adb shell pm list packages查看已知权限组adb shell pm list permission-groups查看手机Feature 支持adb shell pm list features根据包名,查看apk 安装路径adb shell pm path 包名清除app 数据adb shell pm clear 包名多用户相关

查看支持最多用户数 adb shell pm get-max-users

查询系统所有用户 adb shell pm list users

创建新用户 adb shell pm create-user user_name

移除指定id用户 adb shell pm remove-user user_id

dumpsys将系统数据转储到屏幕获取当前运行的Activityadb shell dumpsys activity | findstr Run获取当前指定包名的Activity栈adb shell "dumpsys activity|grep" 包名

’grep‘不是内部或外部命令,也不是可运行的程序 或批处理文件。所以加双引号

获取apk 版本号,权限等信息的方法adb shell dumpsys package com.xxx.xxx(包名)查看手机系统进程使用Top命令查看系统进程adb shell top使用 ps 命令查看系统进程adb shell ps

结合findstr 命令 过滤多余的信息

adb shell ps | findstr qq使用logcat抓 log信息在cmd窗口输出logcat信息adb logcat把logcat输出到文件中adb logcat > D:\1.txt

例子:

#adb logcat -d -b system -v time >本地文件.txt adb logcat -d -b system -v time >C:\Users\Administrator\Desktop\temp\悦以国际\logcat.txt adb logcat -d -b system -v time >C:\Users\Administrator\Desktop\temp\星球秀场\logcat.txt adb logcat -d -b system -v time >C:\Users\Administrator\Desktop\temp\SBC2.0\logcat.txt使用 -s 过滤log标签adb logcat -s 关注log标签

e.g

adb logcat -s AndroidRuntime使用 -c 清除缓存logadb logcat -c电量管理相关命令模拟拔下设备电源adb shell dumpsys battery unplug低电量条件下的行为adb shell settings put global low_power 1恢复电源修改adb shell dumpsys battery resetkeytool 相关查看apk的签名

首先用解压软件解压出META-INF目录下的CERT.RSA文件

keytool -printcert -file D:\Desktop\CERT.RSA查看keystore的签名keytool -list -keystore D:\Desktop\app_key查看keystore的签名keytool -list -v -keystore e:\debug.keystore -storepass xxx(密匙)

 

 

查看AS自带签名文件

Android Studio自带签名文件路径:(密码:android)

C:\Users\Administrator\.android\debug.keystore

keytool -list -v -keystore C:\Users\Administrator\.android\debug.keystoreMonkeyRunner执行键盘录制把monkeyrunner.bat设置到环境变量中:把D:\Android\SDK\tools\bin添加到环境变量中;同时更改环境变量为jdk8脚本record.py#!/usr/bin/env monkeyrunner # Copyright 2010, The Android Open Source Project# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at# # http://www.apache.org/licenses/LICENSE-2.0# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from com.android.monkeyrunner import MonkeyRunner as mr from com.android.monkeyrunner.recorder import MonkeyRecorder as recorder device = mr.waitForConnection() recorder.start(device)

playback.py

#!/usr/bin/env monkeyrunner # Copyright 2010, The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import sys from com.android.monkeyrunner import MonkeyRunner # The format of the file we are parsing is very carfeully constructed. # Each line corresponds to a single command. The line is split into 2 # parts with a | character. Text to the left of the pipe denotes # which command to run. The text to the right of the pipe is a python # dictionary (it can be evaled into existence) that specifies the # arguments for the command. In most cases, this directly maps to the # keyword argument dictionary that could be passed to the underlying # command. # Lookup table to map command strings to functions that implement that # command. CMD_MAP = { 'TOUCH': lambda dev, arg: dev.touch(**arg), 'DRAG': lambda dev, arg: dev.drag(**arg), 'PRESS': lambda dev, arg: dev.press(**arg), 'TYPE': lambda dev, arg: dev.type(**arg), 'WAIT': lambda dev, arg: MonkeyRunner.sleep(**arg) } # Process a single file for the specified device. def process_file(fp, device): for line in fp: (cmd, rest) = line.split('|') try: # Parse the pydict rest = eval(rest) except: print 'unable to parse options' continue if cmd not in CMD_MAP: print 'unknown command: ' + cmd continue CMD_MAP[cmd](device, rest) def main(): file = sys.argv[1] fp = open(file, 'r') device = MonkeyRunner.waitForConnection() process_file(fp, device) fp.close(); if __name__ == '__main__': main()执行录制脚本monkeyrunner d:\replay\record.py

wait: 用来插入下一次操作的时间间隔,点击后即可设置时间,单位是秒

Press a Button:用来确定需要点击的按钮,包括menu、home、search,以及对按钮的press、down、up属性

Type Something:用来输入内容到输入框

Fling:用来进行拖动操作,可以向上、下、左、右,以及操作的范围

Export Actions:用来导出脚本,不需要后缀名,也可以添加后缀名

Refresh Display:用来刷新手机界面,估计只有在断开手机后,重新连接时才会用到

点击“export actions”保存录制脚本到 d:\replay\r

执行回放脚本monkeyrunner d:\replay\playback.py d:\replay\r

其中r是上面录制的脚本文件

如果录制脚本的时候报SWT folder '..\framework\x86_64' does not exist.错误:

那么打开monkeyrunner.bat更改:

.set frameworkdir=lib (纠正)==》set frameworkdir=..\lib .Dcom.android.monkeyrunner.bindir=..\framework -jar %jarpath% %* (纠正)==》Dcom.android.monkeyrunner.bindir=..\..\platform-tools -jar %jarpath% %*问题adb 识别不出的问题

问题:

adb devices adb server is out of date

方法一:

关闭eclipsecmd-->adb nodaemon server找出adb端口(软件默认5037)cmd-->netstat -ano|findstr 5037列出所有端口为5037的记录。找到本地的记录的pid任务管理器中:结束掉该pid的进程,关闭adb.exe重启eclipse

or 命令行关闭占用端口的进程

找出adb端口(软件默认5037) adb nodaemon server列出所有端口为5037的记录。找到本地的记录的pid netstat -ano|findstr 5037结束进程 taskkill -f -im pid

方法二:

停止ADB服务./adb kill-server开启ADB 服务./adb start-server

方法三:

插拔USB重试手机关机重启插上USB后,重新装一下驱动,ADB驱动关掉电脑上360手机助手,安全卫士之类的windows进程下关掉adb.exe; 关掉eclipse重试输入命令:adb kill-service adb start-server adb root adb devices找到.android文件夹,在该文件夹下添加一个adb_usb.ini文件(若已存在,则直接打开修改),里面内容为0xVID号VID号获取方法:计算机管理 -〉设备管理 -〉android phone -> Android Composite ADB Interface ->右键属性-〉详细信息 -〉找到VID_后面的四位数字即可设备android 5以下不能识别到的问题查看开发者是否开启USB调试查看是否选择了传输方式(不会主动弹出,需要去设置里找)adb devices设备名称相同的问题

解决:

只留下一个设备adb shellecho 123321234 >/sys/class/android_usb/android0/iSerialexit 推出shell模式adb kill-serveradb start-serveradb devices问题:adb server is out of date

解决:

关闭eclipsecmd–>adb nodaemon server照出adb端口(软件默认5037)cmd–>netstat -ano|findstr 5037列出所有端口为5037的记录。找到本地的记录的pid任务管理器中:结束掉该pid的进程,关闭adb.exe重启eclipseAndroid Studio运行后选用了AS自带的签名文件

检查AS的Build Variants对应渠道的Active Build Variant(如果两个不同版本打开同一份代码会导致这个变量变掉)

改成对应渠道就是正常的签名文件了(与AS右侧Gradle--ZCZG4.0--daogou--Tasks--build--assembeZcZg打出来的包是一样的)

 

adb bugreport 到本地 adb导出bugreport_adb bugreport 到本地

grep不是内部或外部命令,也不是可运行的程序 或批处理文件。

所以给命令加双引号

如:

//获取指定包名当前的activity栈 adb shell "dumpsys activity|grep" 包名


【本文地址】

公司简介

联系我们

今日新闻


点击排行

实验室常用的仪器、试剂和
说到实验室常用到的东西,主要就分为仪器、试剂和耗
不用再找了,全球10大实验
01、赛默飞世尔科技(热电)Thermo Fisher Scientif
三代水柜的量产巅峰T-72坦
作者:寞寒最近,西边闹腾挺大,本来小寞以为忙完这
通风柜跟实验室通风系统有
说到通风柜跟实验室通风,不少人都纠结二者到底是不
集消毒杀菌、烘干收纳为一
厨房是家里细菌较多的地方,潮湿的环境、没有完全密
实验室设备之全钢实验台如
全钢实验台是实验室家具中较为重要的家具之一,很多

推荐新闻


图片新闻

实验室药品柜的特性有哪些
实验室药品柜是实验室家具的重要组成部分之一,主要
小学科学实验中有哪些教学
计算机 计算器 一般 打孔器 打气筒 仪器车 显微镜
实验室各种仪器原理动图讲
1.紫外分光光谱UV分析原理:吸收紫外光能量,引起分
高中化学常见仪器及实验装
1、可加热仪器:2、计量仪器:(1)仪器A的名称:量
微生物操作主要设备和器具
今天盘点一下微生物操作主要设备和器具,别嫌我啰嗦
浅谈通风柜使用基本常识
 众所周知,通风柜功能中最主要的就是排气功能。在

专题文章

    CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭